package model.dao;

import java.sql.PreparedStatement;
import model.Dao;
import model.entity.Modelo;


public class ModeloDAO extends Dao {

  public static Modelo insert_veiculo(Modelo mod) {
    try {
      PreparedStatement pstmt = getConnection().prepareStatement(
        "Insert Into veiculo(placa, ano_fabricacao, ano_modelo, cor, marca, modelo, proprietario) "
        + "Values(?, ?, ?, ?, ?, ?, ?)");
      pstmt.setObject(1, mod.getMarca().getId());
      pstmt.setObject(2, mod.getId());
      pstmt.setObject(3, mod.getMarca());

      pstmt.executeUpdate();
      //

      pstmt.close();
    } catch (Exception e) {

    }
    return mod;
  }

  public static Modelo update(Modelo mod) {
    try {
      PreparedStatement pstmt = getConnection().prepareStatement(
        "Update Notas Set Nota = ?, Semestre = ?, Materia = ? "
        + "Where id =?");
      pstmt.setObject(1, mod.getMarca().getId());
      pstmt.setObject(2, mod.getId());
      pstmt.setObject(3, mod.getMarca());
  
      pstmt.executeUpdate();
      //
     
      pstmt.close();
    } catch (Exception e) {

    }
 return mod;
  }
}